#include "StatusComponent.h"

const HashedString StatusComponent::type("StatusComponent");


StatusComponent::StatusComponent( Entity* parent ) : IComponent(parent)
{
}

const HashedString& StatusComponent::Type()
{
	return type;
}

StatusComponent::Status& StatusComponent::getStatus( HashedString name )
{
	return m_stats[name];
}

std::string StatusComponent::ToString() const
{
	return std::string();
}

bool StatusComponent::ToXML( tinyxml2::XMLPrinter& printer )
{
	for (StatusMap_t::iterator it = m_stats.begin(); it != m_stats.end(); ++it)
	{
		printer.OpenElement("Status");
		printer.PushAttribute("Name", it->first.getString().c_str());
		printer.PushAttribute("Value", it->second);
		printer.CloseElement();
	}
	return true;
}
